/*
 * Copyright 2018-present KunMinX
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.uduew.sjd.net;

import android.util.Log;

import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;

import com.uduew.sjd.api.AddBankInfoApi;
import com.uduew.sjd.api.AllFormListApi;
import com.uduew.sjd.api.AppControlApi;
import com.uduew.sjd.api.AppUpdateApi;
import com.uduew.sjd.api.AppointFormApi;
import com.uduew.sjd.api.CertificateApi;
import com.uduew.sjd.api.CheckDeviceSubmitApi;
import com.uduew.sjd.api.ContactInfoApi;
import com.uduew.sjd.api.EventTrackingApi;
import com.uduew.sjd.api.GetAddressApi;
import com.uduew.sjd.api.GetMyFeedBackListApi;
import com.uduew.sjd.api.GetJobPostApi;
import com.uduew.sjd.api.PushMessagesApi;
import com.uduew.sjd.api.SubmitAppInfoApi;
import com.uduew.sjd.api.SubmitCalendarApi;
import com.uduew.sjd.api.SubmitCrashApi;
import com.uduew.sjd.api.SubmitDeviceInfoApi;
import com.uduew.sjd.api.SubmitFeedBackAppApi;
import com.uduew.sjd.api.FormListApi;
import com.uduew.sjd.api.AllLoanOrdersApi;
import com.uduew.sjd.api.GetBankInfoApi;
import com.uduew.sjd.api.GetFeedBackTypeApi;
import com.uduew.sjd.api.GetQuestionnaireApi;
import com.uduew.sjd.api.GetUserInfoApi;
import com.uduew.sjd.api.GoogleInfoApi;
import com.uduew.sjd.api.HandlingChargeApi;
import com.uduew.sjd.api.LiveDetectionApi;
import com.uduew.sjd.api.IsRegisterApi;
import com.uduew.sjd.api.LendingBankApi;
import com.uduew.sjd.api.LoanApplicationApi;
import com.uduew.sjd.api.LoginApi;
import com.uduew.sjd.api.MarkApi;
import com.uduew.sjd.api.MessageApi;
import com.uduew.sjd.api.PenileApi;
import com.uduew.sjd.api.PostponeApi;
import com.uduew.sjd.api.ProductHomeApi;
import com.uduew.sjd.api.ProductInfoApi;
import com.uduew.sjd.api.RepaymentLinkApi;
import com.uduew.sjd.api.RepaymentMethodApi;
import com.uduew.sjd.api.RepaymentScheduleApi;
import com.uduew.sjd.api.SetBankInfoApi;
import com.uduew.sjd.api.SubmitAnswerApi;
import com.uduew.sjd.api.SubmitFeedBackDcApi;
import com.uduew.sjd.api.SubmitFormApi;
import com.uduew.sjd.api.SubmitGoogleAppInstanceIdApi;
import com.uduew.sjd.api.SubmitGoogleTokenApi;
import com.uduew.sjd.api.SubmitInstallReferrerApi;
import com.uduew.sjd.api.SubmitIosTokenApi;
import com.uduew.sjd.api.SubmitLogApi;
import com.uduew.sjd.api.SubmitTextMessageApi;
import com.uduew.sjd.api.UpdateBankCardApi;
import com.uduew.sjd.api.UploadFileApi;
import com.uduew.sjd.api.UploadUserInfoApi;
import com.uduew.sjd.bean.HttpBean;
import com.uduew.sjd.bean.IsRegisterBean;
import com.uduew.sjd.bean.LoginBean;
import com.uduew.sjd.config.AppConfig;
import com.uduew.sjd.utils.AesUtils;
import com.hjq.http.EasyHttp;
import com.hjq.http.body.JsonRequestBody;
import com.hjq.http.listener.OnHttpListener;
import com.hjq.http.listener.OnUpdateListener;
import com.uduew.utils.GsonUtils;

import java.util.ArrayList;
import java.util.HashMap;

import io.reactivex.Observable;


public class DataRepository {
    private static final String TAG = "EasyHttp";
    private static final DataRepository S_REQUEST_MANAGER = new DataRepository();

    private DataRepository() {
    }

    public static DataRepository getInstance() {
        return S_REQUEST_MANAGER;
    }

    public void sendCode(LifecycleOwner user, PenileApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }

        });
    }

    public void allLoanOrders(LifecycleOwner user, AllLoanOrdersApi api, DataResult.Result<AllLoanOrdersApi.ResAllLoanOrdersBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<AllLoanOrdersApi.ResAllLoanOrdersBean>() {
            @Override
            public void onHttpSuccess(AllLoanOrdersApi.ResAllLoanOrdersBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    Log.d(TAG, "onHttpSuccess: " + responseStatus.toString());
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void login(LifecycleOwner user, LoginApi api, DataResult.Result<LoginBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<LoginBean>() {
            @Override
            public void onHttpSuccess(LoginBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void isRegister(LifecycleOwner user, IsRegisterApi api, DataResult.Result<HttpBean<IsRegisterBean>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<IsRegisterBean>>() {
            @Override
            public void onHttpSuccess(HttpBean<IsRegisterBean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void formList(LifecycleOwner user, FormListApi api, DataResult.Result<HttpBean<FormListApi.FormListBean>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<FormListApi.FormListBean>>() {
            @Override
            public void onHttpSuccess(HttpBean<FormListApi.FormListBean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void appointFormList(LifecycleOwner user, AppointFormApi api, DataResult.Result<HttpBean<AppointFormApi.AbsquatulationBean>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<AppointFormApi.AbsquatulationBean>>() {
            @Override
            public void onHttpSuccess(HttpBean<AppointFormApi.AbsquatulationBean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void submitForm(LifecycleOwner user, SubmitFormApi api, String control, HashMap<String, Object> nizam, DataResult.Result<HttpBean> result) {
        HashMap<String, Object> overripeMap = new HashMap<>();
        HashMap<String, Object> controlMap = new HashMap<>();
        controlMap.put("control", control);
        controlMap.put("nizam", nizam);
        overripeMap.put("overripe", controlMap);
        String json = GsonUtils.toJson(overripeMap);
        String encrypt = AesUtils.encrypt(json);
        JsonRequestBody jsonRequestBody = new JsonRequestBody(encrypt);
        EasyHttp.post(user).api(api).body(jsonRequestBody).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }


    public Observable<DataResult<HttpBean<UploadFileApi.UploadBean>>> uploadFile(LifecycleOwner user, UploadFileApi api) {
        return AsyncTask.doIO(emitter ->
                EasyHttp.post(user)
                        .api(api)
                        .request(new OnUpdateListener<HttpBean<UploadFileApi.UploadBean>>() {

                            /**
                             * 上传进度改变
                             *
                             * @param progress 上传进度值（0-100）
                             */
                            @Override
                            public void onUpdateProgressChange(int progress) {
                            }

                            /**
                             * 上传成功
                             *
                             */
                            @Override
                            public void onUpdateSuccess(HttpBean<UploadFileApi.UploadBean> response) {
                                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                                emitter.onNext(new DataResult<>(response, responseStatus));
                            }

                            /**
                             * 上传出错
                             *
                             * @param throwable
                             */
                            @Override
                            public void onUpdateFail(@NonNull Throwable throwable) {
                                emitter.onNext(new DataResult<>(null,
                                        new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK)));
                            }


                        }));


    }

    public void certificate(LifecycleOwner user, CertificateApi api, DataResult.Result<HttpBean<CertificateApi.ResCertificateBean>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<CertificateApi.ResCertificateBean>>() {
            @Override
            public void onHttpSuccess(HttpBean<CertificateApi.ResCertificateBean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void uploadUserInfo(LifecycleOwner user, UploadUserInfoApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void getUserInfo(LifecycleOwner user, GetUserInfoApi api, DataResult.Result<HttpBean<GetUserInfoApi.ResGetUserInfoBean>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<GetUserInfoApi.ResGetUserInfoBean>>() {
            @Override
            public void onHttpSuccess(HttpBean<GetUserInfoApi.ResGetUserInfoBean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void liveDetection(LifecycleOwner user, LiveDetectionApi api, DataResult.Result<HttpBean<LiveDetectionApi.ResLiveDetectionBean>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<LiveDetectionApi.ResLiveDetectionBean>>() {
            @Override
            public void onHttpSuccess(HttpBean<LiveDetectionApi.ResLiveDetectionBean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void message(LifecycleOwner user, MessageApi api, DataResult.Result<MessageApi.MessageBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<MessageApi.MessageBean>() {
            @Override
            public void onHttpSuccess(MessageApi.MessageBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void updateApp(LifecycleOwner user, AppUpdateApi api, DataResult.Result<HttpBean<AppUpdateApi.AppUpdateBean>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<AppUpdateApi.AppUpdateBean>>() {
            @Override
            public void onHttpSuccess(HttpBean<AppUpdateApi.AppUpdateBean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void contactInfo(LifecycleOwner user, ContactInfoApi api, DataResult.Result<HttpBean<ContactInfoApi.ContactInfoBean>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<ContactInfoApi.ContactInfoBean>>() {
            @Override
            public void onHttpSuccess(HttpBean<ContactInfoApi.ContactInfoBean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void productInfo(LifecycleOwner user, ProductInfoApi api, DataResult.Result<ProductInfoApi.ResProductInfoBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<ProductInfoApi.ResProductInfoBean>() {
            @Override
            public void onHttpSuccess(ProductInfoApi.ResProductInfoBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void productHome(LifecycleOwner user, ProductHomeApi api, DataResult.Result<HttpBean<ProductHomeApi.ResProductHomeBean>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<ProductHomeApi.ResProductHomeBean>>() {
            @Override
            public void onHttpSuccess(HttpBean<ProductHomeApi.ResProductHomeBean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void handlingCharge(LifecycleOwner user, HandlingChargeApi api, DataResult.Result<HandlingChargeApi.ResHandlingChargeBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HandlingChargeApi.ResHandlingChargeBean>() {
            @Override
            public void onHttpSuccess(HandlingChargeApi.ResHandlingChargeBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void loanApplication(LifecycleOwner user, LoanApplicationApi api, DataResult.Result<HttpBean<ArrayList<LoanApplicationApi.ResLoanApplicationBean>>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<ArrayList<LoanApplicationApi.ResLoanApplicationBean>>>() {
            @Override
            public void onHttpSuccess(HttpBean<ArrayList<LoanApplicationApi.ResLoanApplicationBean>> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void googleInfo(LifecycleOwner user, GoogleInfoApi api, DataResult.Result<HttpBean<GoogleInfoApi.ResGoogleInfoBean>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<GoogleInfoApi.ResGoogleInfoBean>>() {
            @Override
            public void onHttpSuccess(HttpBean<GoogleInfoApi.ResGoogleInfoBean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void mark(LifecycleOwner user, MarkApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void repaymentSchedule(LifecycleOwner user, RepaymentScheduleApi api, DataResult.Result<HttpBean<RepaymentScheduleApi.ResRepaymentScheduleBean>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<RepaymentScheduleApi.ResRepaymentScheduleBean>>() {
            @Override
            public void onHttpSuccess(HttpBean<RepaymentScheduleApi.ResRepaymentScheduleBean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void postpone(LifecycleOwner user, PostponeApi api, DataResult.Result<HttpBean<PostponeApi.PostponeBean>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<PostponeApi.PostponeBean>>() {
            @Override
            public void onHttpSuccess(HttpBean<PostponeApi.PostponeBean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void repaymentMethod(LifecycleOwner user, RepaymentMethodApi api, DataResult.Result<HttpBean<RepaymentMethodApi.ResRePaymentMethodBean>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<RepaymentMethodApi.ResRePaymentMethodBean>>() {
            @Override
            public void onHttpSuccess(HttpBean<RepaymentMethodApi.ResRePaymentMethodBean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void repaymentLink(LifecycleOwner user, RepaymentLinkApi api, DataResult.Result<HttpBean<RepaymentLinkApi.ResRePaymentLinkBean>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<RepaymentLinkApi.ResRePaymentLinkBean>>() {
            @Override
            public void onHttpSuccess(HttpBean<RepaymentLinkApi.ResRePaymentLinkBean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void lendingBank(LifecycleOwner user, LendingBankApi api, DataResult.Result<LendingBankApi.ResLendingBankBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<LendingBankApi.ResLendingBankBean>() {
            @Override
            public void onHttpSuccess(LendingBankApi.ResLendingBankBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }


    public void updateBankCard(LifecycleOwner user, UpdateBankCardApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void getBankCard(LifecycleOwner user, GetBankInfoApi api, DataResult.Result<GetBankInfoApi.ResGetBankInfoBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<GetBankInfoApi.ResGetBankInfoBean>() {
            @Override
            public void onHttpSuccess(GetBankInfoApi.ResGetBankInfoBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }


    public void appControl(LifecycleOwner user, AppControlApi api, DataResult.Result<HttpBean<Boolean>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<Boolean>>() {
            @Override
            public void onHttpSuccess(@NonNull HttpBean<Boolean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }


    public void addBankCard(LifecycleOwner user, AddBankInfoApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void setBankCard(LifecycleOwner user, SetBankInfoApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void feedBack(LifecycleOwner user, SubmitFeedBackAppApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void getQuestionnaire(LifecycleOwner user, GetQuestionnaireApi api, DataResult.Result<GetQuestionnaireApi.ResGetQuestionnaireBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<GetQuestionnaireApi.ResGetQuestionnaireBean>() {
            @Override
            public void onHttpSuccess(GetQuestionnaireApi.ResGetQuestionnaireBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void submitAnswer(LifecycleOwner user, SubmitAnswerApi api, DataResult.Result<HttpBean<SubmitAnswerApi.ResSubmitAnswerBean>> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<SubmitAnswerApi.ResSubmitAnswerBean>>() {
            @Override
            public void onHttpSuccess(HttpBean<SubmitAnswerApi.ResSubmitAnswerBean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void getFeedBackType(LifecycleOwner user, GetFeedBackTypeApi api, DataResult.Result<GetFeedBackTypeApi.ResGetFeedBackTypeBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<GetFeedBackTypeApi.ResGetFeedBackTypeBean>() {
            @Override
            public void onHttpSuccess(GetFeedBackTypeApi.ResGetFeedBackTypeBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void submitFeedBackDc(LifecycleOwner user, SubmitFeedBackDcApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void getMyFeedBackList(LifecycleOwner user, GetMyFeedBackListApi api, DataResult.Result<GetMyFeedBackListApi.ResGetMyFeedBackListBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<GetMyFeedBackListApi.ResGetMyFeedBackListBean>() {
            @Override
            public void onHttpSuccess(GetMyFeedBackListApi.ResGetMyFeedBackListBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void submitTextMessage(LifecycleOwner user, SubmitTextMessageApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void submitLog(LifecycleOwner user, SubmitLogApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void submitGoogleToken(LifecycleOwner user, SubmitGoogleTokenApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void submitIosToken(LifecycleOwner user, SubmitIosTokenApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void submitInstallReferrer(LifecycleOwner user, SubmitInstallReferrerApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void submitGoogleAppInstanceId(LifecycleOwner user, SubmitGoogleAppInstanceIdApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void submitDeviceInfo(LifecycleOwner user, SubmitDeviceInfoApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void submitCrash(LifecycleOwner user, SubmitCrashApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void submitCalendar(LifecycleOwner user, SubmitCalendarApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void submitAppInfo(LifecycleOwner user, SubmitAppInfoApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }


    public void pushMessages(LifecycleOwner user, PushMessagesApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void eventTracking(LifecycleOwner user, EventTrackingApi api, DataResult.Result<HttpBean> result) {
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean>() {
            @Override
            public void onHttpSuccess(HttpBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void checkDeviceSubmit(LifecycleOwner user, CheckDeviceSubmitApi api, DataResult.Result<CheckDeviceSubmitApi.ResCheckDeviceSubmitBean> result) {
        EasyHttp.get(user).api(api).request(new OnHttpListener<CheckDeviceSubmitApi.ResCheckDeviceSubmitBean>() {
            @Override
            public void onHttpSuccess(CheckDeviceSubmitApi.ResCheckDeviceSubmitBean response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }


    public void getJobPost(LifecycleOwner user, GetJobPostApi api, DataResult.Result<HttpBean<ArrayList<GetJobPostApi.JobPostBean>>> result) {
        if (!AppConfig.INSTANCE.isLogin()) {
            return;
        }
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<ArrayList<GetJobPostApi.JobPostBean>>>() {
            @Override
            public void onHttpSuccess(HttpBean<ArrayList<GetJobPostApi.JobPostBean>> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void getAllFormList(LifecycleOwner user, AllFormListApi api, DataResult.Result<HttpBean<AllFormListApi.AllFormListBean>> result) {
        if (!AppConfig.INSTANCE.isLogin()) {
            return;
        }
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<AllFormListApi.AllFormListBean>>() {
            @Override
            public void onHttpSuccess(HttpBean<AllFormListApi.AllFormListBean> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }

    public void getAddress(LifecycleOwner user, GetAddressApi api, DataResult.Result<HttpBean<ArrayList<GetAddressApi.AddressBean>>> result) {
        if (!AppConfig.INSTANCE.isLogin()) {
            return;
        }
        EasyHttp.post(user).api(api).request(new OnHttpListener<HttpBean<ArrayList<GetAddressApi.AddressBean>>>() {
            @Override
            public void onHttpSuccess(HttpBean<ArrayList<GetAddressApi.AddressBean>> response) {
                if (response == null) {
                    ResponseStatus responseStatus = new ResponseStatus("未知错误", false, ResultSource.NETWORK);
                    result.onResult(new DataResult<>(null, responseStatus));
                    return;
                }
                ResponseStatus responseStatus = new ResponseStatus(response.getMsg(), response.isRequestSuccess(), ResultSource.NETWORK);
                result.onResult(new DataResult<>(response, responseStatus));
            }

            @Override
            public void onHttpFail(@NonNull Throwable throwable) {
                Log.d("EasyHttp", "onHttpFail: " + throwable.getMessage());
                ResponseStatus responseStatus = new ResponseStatus(throwable.getMessage(), false, ResultSource.NETWORK);
                result.onResult(new DataResult<>(null, responseStatus));
            }
        });
    }


}
